# v8.getHeapStatistics()

用来获取内存使用情况

const v8 = require('v8');
const statics = v8.getHeapStatistics();
console.log(statics);

输出如下:

{ 
  total_heap_size: 9961472,
  total_heap_size_executable: 1572864,
  total_physical_size: 6266656,
  total_available_size: 1518883592,
  used_heap_size: 4943008,
  heap_size_limit: 1526909922,
  malloced_memory: 8192,
  peak_malloced_memory: 4818552,
  does_zap_garbage: 0 
}